<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Markdown编辑器</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="platforms.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@11.9.0/styles/default.min.css">
    <script src="https://cdn.jsdelivr.net/npm/highlight.js@11.9.0/highlight.min.js"></script>
    <style>
        /* 为编辑区标题栏添加新样式 */
        .editor-header {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            padding: 8px 10px;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .editor-header .title-section {
            display: flex;
            align-items: center;
        }
        
        .editor-toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            margin-top: 5px;
            width: 100%;
            padding: 5px 0;
            border-top: 1px solid #f0f0f0;
        }
        
        .editor-toolbar .tool-btn {
            padding: 4px 8px;
            background: #f8f8f8;
            border: 1px solid #ddd;
            border-radius: 3px;
            cursor: pointer;
            font-size: 14px;
            color: #333;
        }
        
        .editor-toolbar .tool-btn:hover {
            background: #e9e9e9;
        }
        
        /* 调整预览区标题栏样式 */
        .preview-header {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            padding: 8px 10px;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .preview-header .title-section {
            display: flex;
            align-items: center;
        }
        
        .preview-controls {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }
        
        /* 隐藏顶部工具栏，因为所有内容都已移动 */
        .header {
            display: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <!-- 所有内容已移动到预览区标题栏，这里可以隐藏 -->
        </div>

        <div class="content">
            <div class="editor-container">
                <div class="editor-header">
                    <span>编辑区</span>
                    <div class="editor-toolbar">
                        <button id="bold-btn" class="tool-btn" title="加粗"><i class="fa fa-bold"></i></button>
                        <button id="italic-btn" class="tool-btn" title="斜体"><i class="fa fa-italic"></i></button>
                        <button id="heading-btn" class="tool-btn" title="标题"><i class="fa fa-header"></i></button>
                        <button id="link-btn" class="tool-btn" title="链接"><i class="fa fa-link"></i></button>
                        <button id="image-btn" class="tool-btn" title="图片"><i class="fa fa-image"></i></button>
                        <button id="list-btn" class="tool-btn" title="列表"><i class="fa fa-list-ul"></i></button>
                        <button id="quote-btn" class="tool-btn" title="引用"><i class="fa fa-quote-left"></i></button>
                        <button id="code-btn" class="tool-btn" title="代码"><i class="fa fa-code"></i></button>
                    </div>
                    <button id="fullscreen-edit-btn" class="icon-btn" title="全屏编辑"><i class="fa fa-expand"></i></button>
                </div>
                <textarea id="editor" placeholder="请输入Markdown内容...">## 欢迎使用Markdown编辑器

这是一个功能强大的Markdown编辑器，支持实时预览和多平台样式。

### 主要特点

1. **实时预览** - 左侧编辑，右侧实时预览
2. **同步滚动** - 编辑区和预览区可以同步滚动
3. **多平台样式** - 支持微信公众号、知乎等平台的样式预览
4. **智能复制** - 可以保留格式复制到各大平台
5. **电脑/手机模式** - 可以切换预览效果

> 开始编辑吧！</textarea>
            </div>
            <div class="preview-container">
                <div class="preview-header">
                    <div class="title-section">
                        <span>预览区</span>
                    </div>
                    <div class="preview-controls">
                        <select id="platform-selector" class="styled-select">
                            <option value="default">默认样式</option>
                            <option value="wechat">微信公众号</option>
                            <option value="toutiao">今日头条</option>
                            <option value="zhihu">知乎</option>
                            <option value="xiaohongshu">小红书</option>
                        </select>
                        <button id="mode-toggle-btn" class="primary-btn"><i class="fa fa-mobile"></i> 手机预览</button>
                        <button id="copy-btn" class="primary-btn"><i class="fa fa-copy"></i> 复制预览</button>
                        <button id="fullscreen-preview-btn" class="icon-btn" title="全屏预览"><i class="fa fa-expand"></i></button>
                    </div>
                </div>
                <div id="preview"></div>
            </div>
        </div>

        <div class="status-bar">
            <div class="status-info">
                <span id="word-count">字数: 0</span>
                <span id="char-count">字符: 0</span>
            </div>
            <div class="status-actions">
                <button id="save-btn" class="small-btn"><i class="fa fa-save"></i> 保存</button>
                <button id="export-btn" class="small-btn"><i class="fa fa-download"></i> 导出</button>
            </div>
        </div>
    </div>

    <div id="toast" class="toast"></div>

    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/clipboard/dist/clipboard.min.js"></script>
    <script src="app.js"></script>
</body>
</html>
